package com.itheima.config;

import com.itheima.Interceptor.JWTInterceptor;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

import javax.annotation.Resource;

/**
 * @author 林晓伟
 */
@Configuration
public class InterceptorConfig extends WebMvcConfigurationSupport {
    @Resource
    private JWTInterceptor jWTInterceptor;

    @Override
    public void addInterceptors(InterceptorRegistry registry) {

        registry.addInterceptor(jWTInterceptor)
                .addPathPatterns("/**")
                .excludePathPatterns("/user/login","/user/loginout");

    }
}
